function Swiper(el){
    this.el=document.querySelector(el)
    this.ulli=this.el.querySelectorAll('ul li')
    this.num=1
    this.t=null
    this.init()
}

Swiper.prototype.init=function(){
this.dsq()  //自动化
this.yiru() //移入   
this.yichu() //移出
}

//自动化
Swiper.prototype.dsq=function(){
    
  this.dsq()
}
  
//手动
//绑定移入事件  停止定时器 改变图片  同步分页器 改变全局变量num
 Swiper.prototype.yiru=function(){
this.ulli.forEach((item,i)=>{
    item.onmouseover=()=>{
     clearInterval(this.t)
     this.el.querySelector('img').src=`./imgs/img${(i+1)}.jpg`
    this.tbftq((i+1))
    this.num=i+1
    }
})
}


//鼠标移出事件
 Swiper.prototype.yichu=function(){
     this.ulli.forEach((item1)=>{
         item1.onmouseout=()=>{
            this.dsq()
         }
     })
 }

//封装同步分页器
Swiper.prototype.tbftq=function(num){
    this.el.querySelector('ul li.active').className=''
    this.el.querySelector(`ul li:nth-of-type(${num})`).className='active'
}
//封装定时器
Swiper.prototype.dsq=function(){
    this.t= setInterval(()=>{
        this.num++
    if(this.num>6) this.num=1
        this.el.querySelector('img').src=`./imgs/img${this.num}.jpg`
    this.tbftq(this.num)
     
    },1000)
}